
// import {  } from '@/api/vote'

const vote = {
  state: {
    editId: null, 
    decide: '', //判断模板调用时 add/edit
    voteType: 'first',
    isSub: true , //表单提交用到的校验工具
  },

  mutations: {
    SET_VOTE_DECIDE: (state, decide) => {
        state.decide = decide
    },
    SET_EDIT_ID: (state, id) => {
        state.editId = id
    },
    SET_VOTE_TYPE: (state, type) => {
        state.voteType = type
    },
    SET_IS_SUB: (state, bool) => {
        state.isSub = bool
    }
  },

  actions: {
    async SetVoteDecide({ commit }, decide) {
        commit('SET_VOTE_DECIDE', decide)
    },
    async SetEditId({ commit }, id) {
      commit('SET_EDIT_ID', id)
    },
    async SetVoteType({ commit }, type) {
      commit('SET_VOTE_TYPE', type)
    },
    async SetIsSub({ commit }, bool) {
      commit('SET_IS_SUB', bool)
    },
  }
}

export default vote
